<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="imagetoolbar" content="no" />
	<title></title>
	<link rel="stylesheet" type="text/css" href="${base}/admin/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
	<script type="text/javascript" src="${base}/admin/js/jquery-1.7.min.js"></script>
	<script type="text/javascript" src="${base}/admin/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<script type="text/javascript" src="${base}/admin/js/jquery.validate.js"></script>
	<link rel="stylesheet" href="${base}/admin/css/style_workSpace.css" />
<style type="text/css">
	.right{text-align:right; width:80px; color:gray;}
	.left{text-align:left; width:400px;}
	.description{border:1px solid gray; padding:5px;}
	.tr{border-bottom:1px solid gray;}
	a{text-decoration:none;}
	.desc{color:gray; font-size:12px;}
	.error{color:red;}
</style>
</head>
<body>
	 
	<div style="background-image:url(images/bg.gif); height:22px;">
		用户管理 >>个人信息更改
	</div>
	
<form action="" method="post" id="signupForm">
    <div class="content">
      <table>
      <tr class="tr">      		
      		<td><div class="right">用户名：</div></td>
      		<td>
      			<div class="left"><input type="text"  value="${(user.username)!''}" name="user.username" id="user.username" readonly="readonly" />
    			<input type="hidden"  value="${(user.id)!''}" name="user.id" id="user.id" />
    			<span class="error"> &nbsp; </span><span class="verror"></span>    			
    			</div>
    		</td>
    		<td>&nbsp;</td>
      </tr>
       <tr class="tr">      		
      		<td><div class="right">密码：</div></td>
      		<td><input type="password"  value="" name="password" id="password" />
     		</td>
      </tr>    
       <tr class="tr">      		
      		<td><div class="right">确认密码：</div></td>
      		<td><input type="password"  value="" name="user.password" id="user.password" />
     		</td>
      </tr>    
        <tr class="tr">      		
      		<td><div class="right">email：</div></td>
      		<td><input type="text"  value="${(user.email)!''}" name="user.email" id="user.email" />
      		<span class="error"> * </span><span class="verror"></span>
      		</td>
      </tr>
      </table>
      <div align="center" style="margin-top:20px;">
      	<input type="button" onclick="submitUpdate()" value="保存" />
	  	<input type="reset" value="重置" />
      	<input type="button" value="取消" onclick="window.close();" />
      </div>
    </div>
</form>

<#assign errors = fieldErrors>
<#list errors?keys as key>   
	${key}
	<#assign items = errors[key]>
    <#list items as message>
		${message!''}<br>
	</#list>                                      
</#list>

    
</body>

<script type="text/javascript">
	
	function submitUpdate(){		
		 var form = $("#signupForm").serialize();		
  		$.post("personal_update.action", form,function(data){  		
  			data=eval("("+data+")");
  			if(data["status"]==="error"){
	       			alert("信息更改失败");	       			
	       		}else{	       			
	       			alert("信息更改成功");	       			
	       			window.close()
	       		}
  		});
		
	}

	$(document).ready(function() {		
	
	
		$("#signupForm").validate({
			errorPlacement:function(error,element) {  
				element.parent().find(".verror").html(error);
  			},
			rules : {
				"password" :{
					required:true,
					maxlength:18,
					minlength:6,						
				},				
				"user.password" : {
					required:true,	
					maxlength:18,
					minlength:6,							
					equalTo: "#password",
				},							
				"user.email": {
				    required: true,
				    email: true,
			  },
			},
			messages : {
				"password" : {
					required: "请输入密码",
					maxlength: jQuery.format("用户名长度不能大于{0}"),	
					minlength: jQuery.format("用户名长度不能小于{0}"),	
				},				
				"user.password" : {
					"required":"请输入验证密码",
					 maxlength: jQuery.format("用户名长度不能大于{0}"),	
					 minlength: jQuery.format("用户名长度不能小于{0}"),	
					 equalTo: "两次输入密码不一致不一致",
				},				
				"user.email":{
					required:"请输入email地址",
					email:"请输入正确的email地址",
				}
			}
		});
		
	});
	
</script>


</html>